package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.vo.DashboardVo;
import com.cskaoyan.service.StatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("admin/stat")
public class StatController {

    @Autowired
    StatService statService;

    @RequestMapping("dashboard")
    public BaseRespVo dashboard() {
        DashboardVo dashboard = statService.dashboard();
        return BaseRespVo.ok(dashboard);
    }
    /**
     * 获得新增用户统计数量
     * @return
     */
    @RequestMapping("user")
    public BaseRespVo statUser(){
        Map map = statService.userStat();
        return BaseRespVo.ok(map);
    }

    /**
     * 获得订单得统计数量
     * @return
     */
    @RequestMapping("order")
    public BaseRespVo statOrder(){
        Map map = statService.orderStat();
        return BaseRespVo.ok(map);
    }

    /**
     * 获得商品得统计数量
     * @return
     */
    @RequestMapping("goods")
    public BaseRespVo statGoods(){
        Map map = statService.goodsStat();
        return BaseRespVo.ok(map);
    }
}
